package com.smart.mac.init;

import com.smart.mac.model.vo.UserDemoVO;
import com.smart.mac.utls.CacheManagerUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * 用户初始化
 *
 * @Description
 * @Author mac
 */
@Slf4j
@Component
public class UserDemoInit implements ApplicationRunner {

    @Override
    public void run(ApplicationArguments args) throws Exception {
        CacheManagerUtils.put("1111-zhangsan",UserDemoVO.builder().id("1111-zhangsan").username("张三").companyId("1111").companyName("蓝天公司").build());
        CacheManagerUtils.put("1111-lisi",UserDemoVO.builder().id("1111-lisi").username("李四").companyId("1111").companyName("蓝天公司").build());
        CacheManagerUtils.put("1111-wangwu",UserDemoVO.builder().id("1111-wangwu").username("王五").companyId("1111").companyName("蓝天公司").build());
        CacheManagerUtils.put("1111-zhuliu",UserDemoVO.builder().id("1111-zhuliu").username("朱六").companyId("1111").companyName("蓝天公司").build());
        CacheManagerUtils.put("1111-zhaoqi",UserDemoVO.builder().id("1111-zhaoqi").username("赵七").companyId("1111").companyName("蓝天公司").build());
        CacheManagerUtils.put("1111-liuba",UserDemoVO.builder().id("1111-liuba").username("刘八").companyId("1111").companyName("蓝天公司").build());
        CacheManagerUtils.put("2222-zhangfei",UserDemoVO.builder().id("2222-zhangfei").username("张飞").companyId("2222").companyName("白云公司").build());
        CacheManagerUtils.put("2222-guanyu",UserDemoVO.builder().id("2222-guanyu").username("关羽").companyId("2222").companyName("白云公司").build());
        CacheManagerUtils.put("2222-liubei",UserDemoVO.builder().id("2222-liubei").username("刘备").companyId("2222").companyName("白云公司").build());
        log.info("初始化用户个数:{}", CacheManagerUtils.size());
    }
}
